<?php /* Smarty version Smarty-3.1.21-dev, created on 2015-05-06 13:40:15
         compiled from "C:\wamp\www\project.adm.uppii\admin\aplications\views\menu\editmenu.tpl" */ ?>
<?php /*%%SmartyHeaderCode:24755534e4d726dbc5-33955742%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_valid = $_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '8153f768589ea803492c07bdf043f2d6028745ec' => 
    array (
      0 => 'C:\\wamp\\www\\project.adm.uppii\\admin\\aplications\\views\\menu\\editmenu.tpl',
      1 => 1430930412,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '24755534e4d726dbc5-33955742',
  'function' => 
  array (
  ),
  'version' => 'Smarty-3.1.21-dev',
  'unifunc' => 'content_5534e4d72db1d5_28383750',
  'variables' => 
  array (
    'paginas' => 0,
    'pagina' => 0,
    'listaPaginasMenu' => 0,
  ),
  'has_nocache_code' => false,
),false); /*/%%SmartyHeaderCode%%*/?>
<?php if ($_valid && !is_callable('content_5534e4d72db1d5_28383750')) {function content_5534e4d72db1d5_28383750($_smarty_tpl) {?><?php echo '<script'; ?>
 type="text/javascript">
    jQuery(function () {
        if (issetElement("#frm_add_page_menu")) {
            var $_frmAddPage = jQuery("#frm_add_page_menu");
            $_frmAddPage.ajaxForm({
                beforeSubmit: function () {
                    boxMensageLoad("-", '-', true);
                },
                success: function (res) {
                    var url_proccess = window.location.href;
                    var $obj = jQuery.parseJSON(res), ii;
                    if ($obj.status) {
                        boxMensageLoad($obj.msg, "ion ion-checkmark-circled", false);
                        setTimeout(function(){
                             window.location.reload();
                        },1500);
                    } else {
                        boxMensageLoad($obj.msg, "ion ion-alert-circled", false);
                    }
                   
                }
            });
        }//endif

        if (issetElement(".dd-edit")) {
            /*Salva a alteracao da url do menu*/
            jQuery("form[name='frm_edit_menu_page']").each(function (i, v) {
                var $_form = jQuery(v);
                $_form.ajaxForm({
                    beforeSubmit: function () {
                        boxMensageLoad("-", '-', true);
                    },
                    success: function (res) {
                        var $obj = jQuery.parseJSON(res), ii;
                        if (!$obj.status) {
                            ii = "ion ion-alert-circled";
                        } else {
                            ii = "ion ion-checkmark-circled";
                        }
                        boxMensageLoad($obj.msg, ii, false);
                    }
                });
            });

            /*salva a estrutura  do menu criada*/
            jQuery("form[name='frm_estrura_menu']").each(function (i, v) {
                jQuery(v).ajaxForm({
                    beforeSubmit: function () {
                        boxMensageLoad("-", '-', true);
                    },
                    success: function (res) {
                        var $obj = jQuery.parseJSON(res), ii;
                        if (!$obj.status) {
                            ii = "ion ion-alert-circled";
                        } else {
                            ii = "ion ion-checkmark-circled";
                             setTimeout(function(){
                               jQuery('#frm_select_menu').submit();
                            },1500);
                        }
                        boxMensageLoad($obj.msg, ii, false);
                    }
                });
            });
            
            /*remove item do menu*/
            jQuery(document).on("click","[data-id_cms_menu_pagina]",function(e){
                var $_this = jQuery(this), 
                    id_pk_cms_menu_pagina = $_this.data('id_cms_menu_pagina'),
                    url_action = DOMINIOADMIN+'menu/removeitem',
                    url_proccess = window.location.href;
                jQuery.post(url_action,{ id_pk_menu_pagina:id_pk_cms_menu_pagina },function(r){
                    var $obj = jQuery.parseJSON(r);
                    if($obj.status){
                        //jQuery("#nestablelist").on("change",updateOutput);
                        //window.location.href=url_proccess;
                        jQuery('#frm_select_menu').submit();
                    }
                });
                
            });
            
        }//endif
    });
<?php echo '</script'; ?>
>
<div class="row ">
    <div class="col-md-4 v_margin_15x">
        <section class='widget'>
            <header class='widget-header clearfix bgGrayDegrd'>
                <div class='pull-left'>
                    <h5 class='font-bold font-size-g'>Paginas</h5>
                </div>
            </header>
            <div class='widget-content'>
                <form id='frm_add_page_menu' method="POST" action="<?php echo @constant('URLDOMINIOADMIN');?>
menu/adicionarPaginas">
                    <input type="hidden" name="id_menu" value="<?php echo $_GET['id'];?>
" class="input-sm" />
                    <div class='list-page-menu overflow-box-auto'>
                        <ul class="list-unstyled">
                            <?php  $_smarty_tpl->tpl_vars['pagina'] = new Smarty_Variable; $_smarty_tpl->tpl_vars['pagina']->_loop = false;
 $_from = $_smarty_tpl->tpl_vars['paginas']->value; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
foreach ($_from as $_smarty_tpl->tpl_vars['pagina']->key => $_smarty_tpl->tpl_vars['pagina']->value) {
$_smarty_tpl->tpl_vars['pagina']->_loop = true;
?> 
                                <li>
                                    <label class='control checkbox'>
                                        <input type="checkbox" name='page_id[]' value="<?php echo $_smarty_tpl->tpl_vars['pagina']->value['id'];?>
" >
                                        <span class='checkbox-label'><?php echo $_smarty_tpl->tpl_vars['pagina']->value['nome'];?>
</span>
                                    </label>
                                </li>
                            <?php } ?>
                        </ul>                   
                    </div>
                    <div class='border-top v_padding_5x text-right'>
                        <button type="submit" class='btn btn-sm btn-primary'>
                            <i class='ion ion-plus'></i>
                            <span>Adicionar ao menu</span>
                        </button>
                    </div>
                </form><!--end #frm_add_page_menu-->
            </div>
        </section>
    </div>
    <div class="col-md-8 v_margin_15x">
        <section class='widget'>
            <header class='widget-header clearfix bgGrayDegrd'>
                <div class='pull-left'>
                    <h5 class='font-bold font-size-g'>Estrura do menu</h5>
                    <?php if ($_GET['controller']=='menu'&&$_GET['action']=="edit") {?>
                        <?php if (!empty($_GET['id'])) {?>
                            <a id='btn_del_menu' href='javascript:;' class='text-danger' data-id_pk_menu='<?php echo $_GET['id'];?>
'><i class='ion ion-trash-a'></i> Excluir este menu</a>
                        <?php }?>
                    <?php }?>
                </div>
            </header>
            <div class='widget-content'>
                <form name="frm_estrura_menu" method="post" action='<?php echo @constant('URLDOMINIOADMIN');?>
menu/savemenu'>
                    <textarea name="menu_json" rows="5" cols="60" id="output_json" style="display:none;"></textarea>
                    <div class='save_menu_box border-bottom clearfix'>
                        <input type="hidden" name='id_menu' class='inp-name-menu' value="<?php echo $_GET['id'];?>
" />
                        <label class='checkbox'>
                            <input type='checkbox' name='status_menu' value='' />
                            <span class='checkbox-label'>Usar este menu</span>
                        </label>
                        <button type="<?php if ($_GET['id']!='') {?>submit<?php } else { ?>button<?php }?>" class='btn btn-sm <?php if ($_GET['id']!='') {?>btn-success<?php } else { ?>btn-disabled<?php }?>' >
                            <i class='fa fa-save'></i>
                            <span>Salvar estrutura do menu</span>
                        </button>
                    </div>
                </form><!--end form#frm_estruct_menu-->
                <div class='content_menu_estrutura clearfix'>
                    <div class='dd' id='nestablelist'>
                        <?php echo $_smarty_tpl->tpl_vars['listaPaginasMenu']->value;?>

                    </div><!--end #nestablelist-->
                </div><!--end div.content_menu_estrutura-->

            </div>
        </section>
    </div>
</div><!--end div.ROW--><?php }} ?>
